<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>评论详情</title>  
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/base.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/detail.css" />
</head>
<body>
<div class="detail">
    <div class="comment">
    	<ul>
        	<li>
            	<div class="top">
                	<div class="pic"><img src="{$m_info.avatar}"/></div>
                	<h3>{$m_info.nickname}</h3><b>{$m_info.hometown}</b><time>{$e_info.addtime|date="Y-m-d",###}</time>
                </div>
                <div class="wz">
                	<p>{$e_info.content}</p>
                    <p>
                        <volist name="e_info.pic" id="v">
                            <img src="<?=$v?>" />
                        </volist>
                    </p>
                </div>
            </li>
        </ul>
    </div>

    <div class="voice">
    	<h2>全部评论(<b>{$count}</b>)</h2>
    	<ul>
            <volist name="comment" id="vo">
                <li>
                    <div class="pic"><img src="{$vo.avatar}"/></div>
                    <div class="matter">
                        <h3>
                            <span>{$vo.nickname}</span><b>{$vo.hometown}</b>
                            <em class="praise" data-id="{$vo.id}" data-table="evaluate_comment">{$vo.like_num}</em>
                        </h3>
                        <p>{$vo.content}</p>
                        <h4><time>{$vo.addtime|date="Y-m-d",###}</time></h4>
                    </div>
                </li>
            </volist>
        </ul>
    </div>

    <div class="apply">

        <form action="/Wx/MyEvaluate/addComment" method="post" class="js_form">
            <p>
                <input type="text" placeholder="写评论" name="content"/>
                <input type="hidden" name="e_id" value="{$e_info.id}">
                <input type="submit" value="发表"/>
            </p>
        </form>

    </div>

    <!--引用悬浮公共导航文件-->
    <include file="Public:nav" />

</div>
    <script src="__PUBLIC__/Wx/js/jquery.js" ></script>
    <script src="__PUBLIC__/js/jquery.form.js"></script>
    <script src="__PUBLIC__/js/layer/layer.js"></script>

	<script type="text/javascript">
        //表单提交
        $(".js_form").ajaxForm({
            //定义返回JSON数据，还包括xml和script格式
            dataType: 'json',
            success: function(data) {
                //提交成功后调用
                if(data.status==1) {
                    layer.msg(data.info, {icon:1,time:1000},
                        function(){
                            window.location.reload();
                        });
                }else{
                    layer.msg(data.info, {icon:2,time:1000});
                }
            }
        });

        $(".click span").click(function(){
            if($(this).text() ==="导航"){
                $(this).text("收起");
                $('.link02').css('display','block')
            }else{
                $(this).text("导航");
                $('.link02').css('display','none')
            }
        });


		$(".praise").click(function(){
            var e_id = $(this).attr('data-id');
            var table = $(this).attr('data-table');
            var zan = $(this);
            var zan_num = zan.html();

            if($(this).hasClass("praised")){
                $.post('/Wx/MyEvaluate/cancleLike',{e_id:e_id,table:table},function (data) {
                    zan.removeClass("praised");
                    zan.html(zan_num-1)
                })
            }else{
                $.post('/Wx/MyEvaluate/addLike',{e_id:e_id,table:table},function (data) {
                    zan.addClass("praised");
                    zan.html(zan_num*1+1)
                })
            }

        })


	</script>
</body>
</html>